package com.example.netty.tcp.message;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.List;
public class ControlRequest extends BaseMessage {
    public ControlRequest() {
        setMsgType(500); // 远程控制请求类型
    }

    @JsonProperty("paramList")
    private List<ControlParam> paramList; // 参数列表

    // 添加控制参数（信号量ID和值）
    public void addControlParam(String signalId, String value) {
        if (paramList == null) paramList = new ArrayList<>();
        paramList.add(new ControlParam(signalId, value));
    }

    public List<ControlParam> getParamList() {
        return paramList;
    }

    public void setParamList(List<ControlParam> paramList) {
        this.paramList = paramList;
    }

    // 内部参数类
    public static class ControlParam {
        @JsonProperty("id")
        private String id;
        @JsonProperty("value")
        private String value;

        //  添加无参构造函数
        public ControlParam() {
        }
        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public ControlParam(String id, String value) {
            this.id = id;
            this.value = value;
        }
    }
}
